<?php
/*
 * Created on Apr 29, 2012
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 require_once("components/config.inc.php");
 
 class DAOFactory{
 	
 	public static function getDAO($className){
 		$conn = new mysqli(MYSQL_ADDRESS,MYSQL_USERNAME,MYSQL_PASSWORD,MYSQL_DBNAME);
 		
 		switch(strtolower($className)){
 			case "event":
 				require_once("dao/EventDAO.php");
 				return new EventDAO($conn);
 				break;
 			case "player":
 				require_once("dao/PlayerDAO.php");
 				return new PlayerDAO($conn);
 				break;
 			case "photo":
 				require_once("dao/PhotoDAO.php");
 				return new PhotoDAO($conn);
 				break;
 			case "security":
 				require_once("dao/SecurityDAO.php");
 				return new SecurityDAO($conn);
 				break;
 			case "course":
 				require_once("dao/CourseDAO.php");
 				return new CourseDAO($conn);
 				break;
 			case "venue":
 				require_once("dao/VenueDAO.php");
 				return new VenueDAO($conn);
 				break;
 			case "hole":
 				require_once("dao/HoleDAO.php");
 				return new HoleDAO($conn);
 				break;
 			case "datamigration":
 				require_once("dao/DataMigraDAO.php");
 				return new DataMigraDAO($conn);
 				break;
 			case "importstatus":
 				require_once("dao/ImportStatusDAO.php");
 				return new ImportStatusDAO($conn);
 				break;		
 			case "result":
 				require_once("dao/ResultDAO.php");
 				return new ResultDAO($conn);
 				break;
 		}	
 	}
 		
 	
 }
?>
